<template>
    <div class="text_box">
      <h2>{{ text.title }}</h2>
      <div class="metadata">
        <span class="author-id"><strong>作者:</strong> {{ text.username}}</span>
        <span class="date"><strong>日期:</strong> {{ text.date }}</span>
        <span class="type"><strong>类型:</strong> {{ text.kind }}</span>
        <span class="read-count"><strong>阅读量:</strong> {{ text.read }}</span>
        <span class="favorite-count"><strong>收藏数:</strong> {{ text.collect }}</span>
        <span class="like-count"><strong>点赞数:</strong> {{ text.like }}</span>
      </div>
      <div v-html="text.text" class="content"></div>
    </div>
  </template>
  
  <script setup>
  import { defineProps, onMounted } from 'vue';
  
  const props = defineProps({
    text: {
      type: Object,
      required: true
    }
  });
  
  onMounted(() => {
    console.log(props.text);
  });
  </script>
  
  <style scoped>
  .text_box {
    
    min-width: 500px;
    max-width: 800px;
    height: 100%;
    background-color: #f5f7fa; /* 改为更柔和的背景色 */
    border: 1px solid #c3cfe2; /* 改为与作者卡片匹配的边框色 */
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 4px 8px rgba(195, 207, 226, 0.3); /* 调整阴影颜色 */
  }
  
  .text_box > h2 {
    margin-top: 10px;
    height: auto;
    text-align: center;
    color: #2c3e50; /* 改为深蓝色标题 */
    border-bottom: 2px solid #c3cfe2; /* 调整下划线颜色 */
    padding-bottom: 10px;
  }
  
  .metadata {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    margin-bottom: 20px;
    padding: 10px;
    background-color: rgba(195, 207, 226, 0.3); /* 改为半透明背景 */
    border-radius: 5px;
  }
  
  .metadata > span {
    margin: 5px 0;
    font-size: 14px;
    color: #4a5568; /* 改为中灰色文字 */
  }
  
  .metadata strong {
    color: #2c3e50; /* 强调文字改为深蓝色 */
  }
  
  .content {
    line-height: 1.6;
    height: auto;
    color: #4a5568; /* 正文文字颜色调整 */
    overflow: auto; /* 添加溢出处理 */
  }
  
  /* 为v-html内容添加基本颜色样式 */
  .content :deep(a) {
    color: #3182ce; /* 链接颜色 */
  }
  
  .content :deep(a:hover) {
    color: #1a73e8; /* 链接悬停颜色 */
  }
  </style>